package org.dxy.infrastructure.adapter;

import org.dxy.domain.port.IdGenerator;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.lang.Snowflake;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: dxy
 * @createTime: 2025/6/12 23:17
 */
@Component
public class HutoolIdGenerator implements IdGenerator {
    // 使用机器ID=1，数据中心ID=1
    private final Snowflake snowflake = IdUtil.getSnowflake(1, 1);

    @Override
    public Long generate() {
        return snowflake.nextId();
    }
}
